#include "GameWindow.h"

GameWindow::GameWindow()
{
    spdlog::debug("GameWindow init start");
    initgraph(640, 480);
}
GameWindow::GameWindow(cfg_t config)
{
}

std::string GameWindow::HWNDToString(HWND hwnd)
{
    char buffer[20]; // 适当的缓冲区大小
    snprintf(buffer, sizeof(buffer), "%p", hwnd);
    return buffer;
}

bool GameWindow::IsWindowClosed(HWND hwnd)
{
    std::string hw = HWNDToString(hwnd);
    int size = hw.size();
    for(int i = size - 1; i>0; i--)
    {
        if('0' != hw.at(i))
        {
            return false;
        }
    }
    shouldExit = true;
    return true;
}

bool GameWindow::GetWindowClosed()
{
    return IsWindowClosed(GetHWnd());
}